package com.powernode.service.impl;

import com.powernode.commons.ResultEnum;
import com.powernode.commons.ResultException;
import com.powernode.mapper.GoodsMapper;
import com.powernode.pojo.Goods;
import com.powernode.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<Goods> findByList() {
        List<Goods> goods = goodsMapper.selectAll();
        if (goods.size() == 0){
            throw new ResultException(ResultEnum.NOT_DATA_FOUND);
        }
        return goods;
    }
}
